home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / SpeechSynthesis.a < prev    next >
Encoding:
Text File  |  1998-02-12  |  13.0 KB  |  511 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        SpeechSynthesis.a
  3. ;
  4. ;    Contains:    Speech Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1989-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__SPEECHSYNTHESIS__') = 'UNDEFINED' THEN
  19. __SPEECHSYNTHESIS__ SET 1
  20.  
  21.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  22.     include 'MacTypes.a'
  23.     ENDIF
  24.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  25.     include 'MixedMode.a'
  26.     ENDIF
  27.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  28.     include 'Files.a'
  29.     ENDIF
  30.  
  31.  
  32. kTextToSpeechSynthType            EQU        'ttsc'
  33. kTextToSpeechVoiceType            EQU        'ttvd'
  34. kTextToSpeechVoiceFileType        EQU        'ttvf'
  35. kTextToSpeechVoiceBundleType    EQU        'ttvb'
  36.  
  37. kNoEndingProsody                EQU        1
  38. kNoSpeechInterrupt                EQU        2
  39. kPreflightThenPause                EQU        4
  40.  
  41. kImmediate                        EQU        0
  42. kEndOfWord                        EQU        1
  43. kEndOfSentence                    EQU        2
  44.  
  45. ; ------------------------------------------
  46. ;  GetSpeechInfo & SetSpeechInfo selectors    
  47. ; ------------------------------------------
  48.  
  49. soStatus                        EQU        'stat'
  50. soErrors                        EQU        'erro'
  51. soInputMode                        EQU        'inpt'
  52. soCharacterMode                    EQU        'char'
  53. soNumberMode                    EQU        'nmbr'
  54. soRate                            EQU        'rate'
  55. soPitchBase                        EQU        'pbas'
  56. soPitchMod                        EQU        'pmod'
  57. soVolume                        EQU        'volm'
  58. soSynthType                        EQU        'vers'
  59. soRecentSync                    EQU        'sync'
  60. soPhonemeSymbols                EQU        'phsy'
  61. soCurrentVoice                    EQU        'cvox'
  62. soCommandDelimiter                EQU        'dlim'
  63. soReset                            EQU        'rset'
  64. soCurrentA5                        EQU        'myA5'
  65. soRefCon                        EQU        'refc'
  66. soTextDoneCallBack                EQU        'tdcb'                ; use with SpeechTextDoneProcPtr
  67. soSpeechDoneCallBack            EQU        'sdcb'                ; use with SpeechDoneProcPtr
  68. soSyncCallBack                    EQU        'sycb'                ; use with SpeechSyncProcPtr
  69. soErrorCallBack                    EQU        'ercb'                ; use with SpeechErrorProcPtr
  70. soPhonemeCallBack                EQU        'phcb'                ; use with SpeechPhonemeProcPtr
  71. soWordCallBack                    EQU        'wdcb'
  72. soSynthExtension                EQU        'xtnd'
  73. soSoundOutput                    EQU        'sndo'
  74.  
  75. ; ------------------------------------------
  76. ;  Speaking Mode Constants                     
  77. ; ------------------------------------------
  78.  
  79. modeText                        EQU        'TEXT'                ; input mode constants                     
  80. modePhonemes                    EQU        'PHON'
  81. modeNormal                        EQU        'NORM'                ; character mode and number mode constants 
  82. modeLiteral                        EQU        'LTRL'
  83.  
  84.  
  85. soVoiceDescription                EQU        'info'
  86. soVoiceFile                        EQU        'fref'
  87.  
  88.  
  89.  
  90.  
  91. VoiceSpec                RECORD 0
  92. creator                     ds.l    1                ; offset: $0 (0)
  93. id                         ds.l    1                ; offset: $4 (4)
  94. sizeof                     EQU *                    ; size:   $8 (8)
  95.                         ENDR
  96. ; typedef struct VoiceSpec *            VoiceSpecPtr
  97.  
  98.  
  99.  
  100. kNeuter                            EQU        0
  101. kMale                            EQU        1
  102. kFemale                            EQU        2
  103.  
  104.  
  105.  
  106. VoiceDescription        RECORD 0
  107. length                     ds.l    1                ; offset: $0 (0)
  108. voice                     ds        VoiceSpec        ; offset: $4 (4)
  109. version                     ds.l    1                ; offset: $C (12)
  110. name                     ds        Str63            ; offset: $10 (16)
  111. comment                     ds        Str255            ; offset: $50 (80)
  112. gender                     ds.w    1                ; offset: $150 (336)
  113. age                         ds.w    1                ; offset: $152 (338)
  114. script                     ds.w    1                ; offset: $154 (340)
  115. language                 ds.w    1                ; offset: $156 (342)
  116. region                     ds.w    1                ; offset: $158 (344)
  117. reserved                 ds.l    4                ; offset: $15A (346)
  118. sizeof                     EQU *                    ; size:   $16A (362)
  119.                         ENDR
  120.  
  121.  
  122. VoiceFileInfo            RECORD 0
  123. fileSpec                 ds        FSSpec            ; offset: $0 (0)
  124. resID                     ds.w    1                ; offset: $46 (70)
  125. sizeof                     EQU *                    ; size:   $48 (72)
  126.                         ENDR
  127. SpeechStatusInfo        RECORD 0
  128. outputBusy                 ds.b    1                ; offset: $0 (0)
  129. outputPaused             ds.b    1                ; offset: $1 (1)
  130. inputBytesLeft             ds.l    1                ; offset: $2 (2)
  131. phonemeCode                 ds.w    1                ; offset: $6 (6)
  132. sizeof                     EQU *                    ; size:   $8 (8)
  133.                         ENDR
  134.  
  135.  
  136. SpeechErrorInfo            RECORD 0
  137. count                     ds.w    1                ; offset: $0 (0)
  138. oldest                     ds.w    1                ; offset: $2 (2)
  139. oldPos                     ds.l    1                ; offset: $4 (4)
  140. newest                     ds.w    1                ; offset: $8 (8)
  141. newPos                     ds.l    1                ; offset: $A (10)
  142. sizeof                     EQU *                    ; size:   $E (14)
  143.                         ENDR
  144.  
  145.  
  146. SpeechVersionInfo        RECORD 0
  147. synthType                 ds.l    1                ; offset: $0 (0)
  148. synthSubType             ds.l    1                ; offset: $4 (4)
  149. synthManufacturer         ds.l    1                ; offset: $8 (8)
  150. synthFlags                 ds.l    1                ; offset: $C (12)
  151. synthVersion             ds        NumVersion        ; offset: $10 (16)
  152. sizeof                     EQU *                    ; size:   $14 (20)
  153.                         ENDR
  154.  
  155.  
  156. PhonemeInfo                RECORD 0
  157. opcode                     ds.w    1                ; offset: $0 (0)
  158. phStr                     ds        Str15            ; offset: $2 (2)
  159. exampleStr                 ds        Str31            ; offset: $12 (18)
  160. hiliteStart                 ds.w    1                ; offset: $32 (50)
  161. hiliteEnd                 ds.w    1                ; offset: $34 (52)
  162. sizeof                     EQU *                    ; size:   $36 (54)
  163.                         ENDR
  164.  
  165. PhonemeDescriptor        RECORD 0
  166. phonemeCount             ds.w    1                ; offset: $0 (0)
  167. thePhonemes                 ds        PhonemeInfo        ; offset: $2 (2) <-- really an array of length one
  168. sizeof                     EQU *                    ; size:   $38 (56)
  169.                         ENDR
  170. SpeechXtndData            RECORD 0
  171. synthCreator             ds.l    1                ; offset: $0 (0)
  172. synthData                 ds.b    2                ; offset: $4 (4)
  173. sizeof                     EQU *                    ; size:   $6 (6)
  174.                         ENDR
  175.  
  176. DelimiterInfo            RECORD 0
  177. startDelimiter             ds.b    2                ; offset: $0 (0)
  178. endDelimiter             ds.b    2                ; offset: $2 (2)
  179. sizeof                     EQU *                    ; size:   $4 (4)
  180.                         ENDR
  181.  
  182. ;
  183. ; pascal NumVersion SpeechManagerVersion(void )
  184. ;
  185.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  186.         Macro
  187.         _SpeechManagerVersion
  188.             move.l              #$0000000C,D0
  189.             dc.w                $A800
  190.         EndM
  191.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  192.         IMPORT_CFM_FUNCTION SpeechManagerVersion
  193.     ENDIF
  194.  
  195. ;
  196. ; pascal OSErr MakeVoiceSpec(OSType creator, OSType id, VoiceSpec *voice)
  197. ;
  198.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  199.         Macro
  200.         _MakeVoiceSpec
  201.             move.l              #$0604000C,D0
  202.             dc.w                $A800
  203.         EndM
  204.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  205.         IMPORT_CFM_FUNCTION MakeVoiceSpec
  206.     ENDIF
  207.  
  208. ;
  209. ; pascal OSErr CountVoices(short *numVoices)
  210. ;
  211.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  212.         Macro
  213.         _CountVoices
  214.             move.l              #$0108000C,D0
  215.             dc.w                $A800
  216.         EndM
  217.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  218.         IMPORT_CFM_FUNCTION CountVoices
  219.     ENDIF
  220.  
  221. ;
  222. ; pascal OSErr GetIndVoice(short index, VoiceSpec *voice)
  223. ;
  224.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  225.         Macro
  226.         _GetIndVoice
  227.             move.l              #$030C000C,D0
  228.             dc.w                $A800
  229.         EndM
  230.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  231.         IMPORT_CFM_FUNCTION GetIndVoice
  232.     ENDIF
  233.  
  234. ;
  235. ; pascal OSErr GetVoiceDescription(const VoiceSpec *voice, VoiceDescription *info, long infoLength)
  236. ;
  237.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  238.         Macro
  239.         _GetVoiceDescription
  240.             move.l              #$0610000C,D0
  241.             dc.w                $A800
  242.         EndM
  243.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  244.         IMPORT_CFM_FUNCTION GetVoiceDescription
  245.     ENDIF
  246.  
  247. ;
  248. ; pascal OSErr GetVoiceInfo(const VoiceSpec *voice, OSType selector, void *voiceInfo)
  249. ;
  250.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  251.         Macro
  252.         _GetVoiceInfo
  253.             move.l              #$0614000C,D0
  254.             dc.w                $A800
  255.         EndM
  256.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  257.         IMPORT_CFM_FUNCTION GetVoiceInfo
  258.     ENDIF
  259.  
  260. ;
  261. ; pascal OSErr NewSpeechChannel(VoiceSpecPtr voice, SpeechChannel *chan)
  262. ;
  263.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  264.         Macro
  265.         _NewSpeechChannel
  266.             move.l              #$0418000C,D0
  267.             dc.w                $A800
  268.         EndM
  269.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  270.         IMPORT_CFM_FUNCTION NewSpeechChannel
  271.     ENDIF
  272.  
  273. ;
  274. ; pascal OSErr DisposeSpeechChannel(SpeechChannel chan)
  275. ;
  276.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  277.         Macro
  278.         _DisposeSpeechChannel
  279.             move.l              #$021C000C,D0
  280.             dc.w                $A800
  281.         EndM
  282.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  283.         IMPORT_CFM_FUNCTION DisposeSpeechChannel
  284.     ENDIF
  285.  
  286. ;
  287. ; pascal OSErr SpeakString(ConstStr255Param textToBeSpoken)
  288. ;
  289.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  290.         Macro
  291.         _SpeakString
  292.             move.l              #$0220000C,D0
  293.             dc.w                $A800
  294.         EndM
  295.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  296.         IMPORT_CFM_FUNCTION SpeakString
  297.     ENDIF
  298.  
  299. ;
  300. ; pascal OSErr SpeakText(SpeechChannel chan, const void *textBuf, unsigned long textBytes)
  301. ;
  302.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  303.         Macro
  304.         _SpeakText
  305.             move.l              #$0624000C,D0
  306.             dc.w                $A800
  307.         EndM
  308.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  309.         IMPORT_CFM_FUNCTION SpeakText
  310.     ENDIF
  311.  
  312. ;
  313. ; pascal OSErr SpeakBuffer(SpeechChannel chan, const void *textBuf, unsigned long textBytes, long controlFlags)
  314. ;
  315.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  316.         Macro
  317.         _SpeakBuffer
  318.             move.l              #$0828000C,D0
  319.             dc.w                $A800
  320.         EndM
  321.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  322.         IMPORT_CFM_FUNCTION SpeakBuffer
  323.     ENDIF
  324.  
  325. ;
  326. ; pascal OSErr StopSpeech(SpeechChannel chan)
  327. ;
  328.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  329.         Macro
  330.         _StopSpeech
  331.             move.l              #$022C000C,D0
  332.             dc.w                $A800
  333.         EndM
  334.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  335.         IMPORT_CFM_FUNCTION StopSpeech
  336.     ENDIF
  337.  
  338. ;
  339. ; pascal OSErr StopSpeechAt(SpeechChannel chan, long whereToStop)
  340. ;
  341.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  342.         Macro
  343.         _StopSpeechAt
  344.             move.l              #$0430000C,D0
  345.             dc.w                $A800
  346.         EndM
  347.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  348.         IMPORT_CFM_FUNCTION StopSpeechAt
  349.     ENDIF
  350.  
  351. ;
  352. ; pascal OSErr PauseSpeechAt(SpeechChannel chan, long whereToPause)
  353. ;
  354.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  355.         Macro
  356.         _PauseSpeechAt
  357.             move.l              #$0434000C,D0
  358.             dc.w                $A800
  359.         EndM
  360.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  361.         IMPORT_CFM_FUNCTION PauseSpeechAt
  362.     ENDIF
  363.  
  364. ;
  365. ; pascal OSErr ContinueSpeech(SpeechChannel chan)
  366. ;
  367.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  368.         Macro
  369.         _ContinueSpeech
  370.             move.l              #$0238000C,D0
  371.             dc.w                $A800
  372.         EndM
  373.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  374.         IMPORT_CFM_FUNCTION ContinueSpeech
  375.     ENDIF
  376.  
  377. ;
  378. ; pascal short SpeechBusy(void )
  379. ;
  380.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  381.         Macro
  382.         _SpeechBusy
  383.             move.l              #$003C000C,D0
  384.             dc.w                $A800
  385.         EndM
  386.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  387.         IMPORT_CFM_FUNCTION SpeechBusy
  388.     ENDIF
  389.  
  390. ;
  391. ; pascal short SpeechBusySystemWide(void )
  392. ;
  393.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  394.         Macro
  395.         _SpeechBusySystemWide
  396.             move.l              #$0040000C,D0
  397.             dc.w                $A800
  398.         EndM
  399.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  400.         IMPORT_CFM_FUNCTION SpeechBusySystemWide
  401.     ENDIF
  402.  
  403. ;
  404. ; pascal OSErr SetSpeechRate(SpeechChannel chan, Fixed rate)
  405. ;
  406.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  407.         Macro
  408.         _SetSpeechRate
  409.             move.l              #$0444000C,D0
  410.             dc.w                $A800
  411.         EndM
  412.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  413.         IMPORT_CFM_FUNCTION SetSpeechRate
  414.     ENDIF
  415.  
  416. ;
  417. ; pascal OSErr GetSpeechRate(SpeechChannel chan, Fixed *rate)
  418. ;
  419.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  420.         Macro
  421.         _GetSpeechRate
  422.             move.l              #$0448000C,D0
  423.             dc.w                $A800
  424.         EndM
  425.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  426.         IMPORT_CFM_FUNCTION GetSpeechRate
  427.     ENDIF
  428.  
  429. ;
  430. ; pascal OSErr SetSpeechPitch(SpeechChannel chan, Fixed pitch)
  431. ;
  432.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  433.         Macro
  434.         _SetSpeechPitch
  435.             move.l              #$044C000C,D0
  436.             dc.w                $A800
  437.         EndM
  438.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  439.         IMPORT_CFM_FUNCTION SetSpeechPitch
  440.     ENDIF
  441.  
  442. ;
  443. ; pascal OSErr GetSpeechPitch(SpeechChannel chan, Fixed *pitch)
  444. ;
  445.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  446.         Macro
  447.         _GetSpeechPitch
  448.             move.l              #$0450000C,D0
  449.             dc.w                $A800
  450.         EndM
  451.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  452.         IMPORT_CFM_FUNCTION GetSpeechPitch
  453.     ENDIF
  454.  
  455. ;
  456. ; pascal OSErr SetSpeechInfo(SpeechChannel chan, OSType selector, const void *speechInfo)
  457. ;
  458.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  459.         Macro
  460.         _SetSpeechInfo
  461.             move.l              #$0654000C,D0
  462.             dc.w                $A800
  463.         EndM
  464.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  465.         IMPORT_CFM_FUNCTION SetSpeechInfo
  466.     ENDIF
  467.  
  468. ;
  469. ; pascal OSErr GetSpeechInfo(SpeechChannel chan, OSType selector, void *speechInfo)
  470. ;
  471.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  472.         Macro
  473.         _GetSpeechInfo
  474.             move.l              #$0658000C,D0
  475.             dc.w                $A800
  476.         EndM
  477.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  478.         IMPORT_CFM_FUNCTION GetSpeechInfo
  479.     ENDIF
  480.  
  481. ;
  482. ; pascal OSErr TextToPhonemes(SpeechChannel chan, const void *textBuf, unsigned long textBytes, Handle phonemeBuf, long *phonemeBytes)
  483. ;
  484.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  485.         Macro
  486.         _TextToPhonemes
  487.             move.l              #$0A5C000C,D0
  488.             dc.w                $A800
  489.         EndM
  490.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  491.         IMPORT_CFM_FUNCTION TextToPhonemes
  492.     ENDIF
  493.  
  494. ;
  495. ; pascal OSErr UseDictionary(SpeechChannel chan, Handle dictionary)
  496. ;
  497.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  498.         Macro
  499.         _UseDictionary
  500.             move.l              #$0460000C,D0
  501.             dc.w                $A800
  502.         EndM
  503.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  504.         IMPORT_CFM_FUNCTION UseDictionary
  505.     ENDIF
  506.  
  507.  
  508.  
  509.     ENDIF ; __SPEECHSYNTHESIS__ 
  510.  
  511.